# Author: Yu Bin
# Date: 2024/12/26 08:59:45
# E-mail: 853823259@qq.com

import module

module.print_line('*', 50)

my_list = [1, 2, 3]
my_list.append(4)
for i in my_list:
    print(i, end='  ')

print('\n')

name_list = ['tom', 'jerry', 'spark']
# 取值
print(name_list[2])
# 查找元素
print(name_list.index('tom'))
# 修改
name_list[1] = 'yubin'
print(name_list)
# 添加
name_list.append('wangwu')
print(name_list)
name_list.insert(1, '王晓梅')
print(name_list)
temp_list = ['sdfds', 'dsfa', 'fdsf']
name_list.extend(temp_list)
print(name_list)
# 删除
name_list.remove('wangwu')
print(name_list)

# 统计
print(len(name_list))
# 排序
num_list = [23, 543, 121, 45, 2, 1, 5]
num_list.sort()
name_list.sort()
print(name_list)
print(num_list)

# 遍历
for name in name_list:
    print("my name is %s" % name)
print('-' * 50)
i = 0
while i < len(name_list):
    print(name_list[i])
    i = i + 1

# 列表生成
my_list = [x for x in range(10)]
print(my_list)
